home *** CD-ROM | disk | FTP | other *** search
- Path: newsfeed.internetmci.com!iol!usenet
- From: David Byrden <Goyra@iol.ie>
- Newsgroups: comp.lang.c++
- Subject: Re: The STL and nested structures
- Date: 3 Apr 1996 19:18:54 GMT
- Organization: Ireland On-Line
- Message-ID: <4juiuu$q4c@nuacht.iol.ie>
- References: <4ju9q7$fa1$1@mhadg.production.compuserve.com>
- NNTP-Posting-Host: dialup-327.dublin.iol.ie
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22KIT (Windows; I; 16bit)
-
- Alan Huff <74312.2300@CompuServe.COM> wrote:
- >I am having a problem using the STL with structures defined within
- >a class definition. Consider the following code fragment.
- >
- >>#include <vector.h>
- >>class Bar {
- >> struct Foo {
- >> int value;
- >> };
- >>
- >> vector< Foo > fooContainer;
- >>}
- >
- >The compiler I am using (VC 4.1) refuses to compile. An error is
- >generated the says "'Foo' : undeclared identifier" at line 75 in
- >vector.h.
- >
- >Line 75 of vector.h
- >> vector(size_type n, const T& value = T()) { ...
- >
- >If I move the structure Foo out of the class and into the global
- >namespace there are no compilation errors.
- >
- >What am I missing??
-
-
- Check out Microsoft's online bug list for VC4. I remember (my
- docs are elsewhere) one bug which was a template class being instantiated
- by use as a default parameter, and that line 75 did used to cause it for
- me. The solution was to force class instantiation previous to that line.
-
- David
-
-
-